//
//  MylistCell.m
//  Ten
//
//  Created by anfuer on 2018/8/16.
//  Copyright © 2018年 xg韦. All rights reserved.
//

#import "MylistCell.h"
@interface MylistCell()
{
    NSDictionary*dict;
}
@end
@implementation MylistCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
+ (instancetype)CellWithTableView:(UITableView *)tableView
{
    static NSString *reuseId = @"MylistCell";
    MylistCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseId];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"MylistCell" owner:nil options:nil] lastObject];
        
    }
    
    
    return cell;
    
    
}
-(void)Cellinit:(NSDictionary*)dic
{
     dict=dic;
     NSDictionary*tempdic=dic[@"job_detail"];
    _lb1.text=WXGStr(tempdic[@"title"]);
    _lb2.text=[NSString stringWithFormat:@"￥%@/%@",tempdic[@"salary"],[WXGStr(tempdic[@"salary_type"])isEqualToString:@"2"]?@"月":@"日"];
    _lb3.text=WXGStr(tempdic[@"city_name"]);
    _lb4.text=[NSString stringWithFormat:@"开始时间:%@",[FuncPublic time:dic[@"add_time"]]] ;
     _lb5.text=WXGStr(dic[@"status_name"]);
    if ([WXGStr(dic[@"status"])isEqualToString:@"0"]&&[WXGStr(dic[@"type"])isEqualToString:@"2"]) {
        _btn1o.hidden=NO;
    }else
    {
        _btn1o.hidden=YES;
    }
   
}

- (IBAction)btna:(UIButton *)sender {
    if ([[sender currentTitle] isEqualToString:@"联系该公司"]) {
             NSMutableString* str=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",dict[@"company"][@"phone"]];
             [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
        
    }else if ([[sender currentTitle] isEqualToString:@"接受任务"])
    {
        [FuncPublic getData:nil parameters:@{@"id":WXGStr(dict[@"id"])} RequestUrl:accept_deliver success:^(NSDictionary *acountInfo) {
             [WSProgressHUD showImage:nil status:@"请求成功"];
            self.completion(sender);
            
        }];

    }
    
}




@end
